package dao;
import java.sql.CallableStatement;
import java.sql.Connection;
import entity.Tour;
import connectUtil.ConnectionUtil;

public class AddTourDAO {
	private static Connection con = null;
	private static CallableStatement call = null;
	public static boolean Addtour(Tour tour){
		System.out.println("In addtour");
		try{
			con = ConnectionUtil.getConnection();
			call = con.prepareCall("{call addTour(?,?,?,?,?,?,?,?,?)}");
			call.setString(1, tour.getTourName());
			call.setString(2, tour.getPlace());
			call.setDate(3, tour.getStartDate());
			call.setDate(4, tour.getEndDate());
			call.setFloat(5, tour.getPrice());
			call.setString(6, tour.getImages());
			call.setShort(7, tour.getMaxVisitors());
			call.setShort(8, tour.getCurrentVisitors());
			call.setString(9, tour.getTag());
			call.executeUpdate();
			return true;
		}
		catch (Exception e) {
			e.printStackTrace();
			return false;
		} finally {
	        ConnectionUtil.closeConnections(con, call, null);
		}
	}

}
